/**
 *    Copyright 2009-2019 the original author or authors.
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package org.apache.ibatis.session;

import java.sql.Connection;

/**
 * Mybatis核心接口之一，采用工厂方法模式
 *
 * 主要用于创建SqlSession的工厂接口，提供了多种创建SqlSession的方法。
 * Mybatis为该接口提供了一个默认的实现类DefaultSqlSessionFactory，创建默认的
 * SqlSessionFactory的任务交给了建造者SqlSessionFactoryBuilder。
 * 另外，该类还提供了获取Mybatis配置信息的方法
 *
 * 创建完成后，SqlSessionFactory对象应该保存至运用程序执行结束，最好不要多次创建或者销毁该对象
 *
 * @see org.apache.ibatis.session.SqlSessionFactoryBuilder
 * @see org.apache.ibatis.session.SqlSession
 * @date: 2019-07-04 15:19
 */
public interface SqlSessionFactory {

  SqlSession openSession();

  SqlSession openSession(boolean autoCommit);

  SqlSession openSession(Connection connection);

  SqlSession openSession(TransactionIsolationLevel level);

  SqlSession openSession(ExecutorType execType);

  SqlSession openSession(ExecutorType execType, boolean autoCommit);

  SqlSession openSession(ExecutorType execType, TransactionIsolationLevel level);

  SqlSession openSession(ExecutorType execType, Connection connection);

  Configuration getConfiguration();

}
